import json, re

o365_infos = {}
with open('o365_servers.json','r') as load_f:
    o365_infos = json.load(load_f)


urls = set()
ips = set()
for service in o365_infos:
    if service.has_key(u'urls'):
        for url in service[u'urls']:
            # print(url)
            urls.add(re.sub("\*.*?\.", "", url))
    if service.has_key(u'ips'):
        for ip in service[u'ips']:
            ips.add(ip)

print('------------------------')
for url in urls:
    print(url)

for ip in ips:
    print(ip)